<?php
/*
	[Destoon B2B System] Copyright (c) 2008-2016 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
if($DT['city']) {
	$DT['index_html'] = 0;
	$C = cache_read('module-2.php');
	$M = $C['linkurl'];
} else {
	$M = $MODULE[2]['linkurl'];
}
$data = '';
$data .= 'var DTPath = "'.DT_PATH.'";';
$data .= 'var SKPath = "'.DT_SKIN.'";';
$data .= 'var MEPath = "'.$M.'";';
$data .= 'var DTEditor = "'.DT_EDITOR.'";';
$data .= 'var CKDomain = "'.$CFG['cookie_domain'].'";';
$data .= 'var CKPath = "'.$CFG['cookie_path'].'";';
$data .= 'var CKPrex = "'.$CFG['cookie_pre'].'";';
file_put(DT_ROOT.'/file/script/config.js', $data);

$filename = $CFG['com_dir'] ? DT_ROOT.'/'.$DT['push_filename'] .'.'.$DT['file_ext'] : DT_CACHE.'/index.inc.html';
if(!$DT['index_html']) {
	if(is_file($filename)) unlink($filename);
	return false;
}
if(!$db->linked) return false;
$destoon_task = "moduleid=1&html=index";
$AREA = cache_read('area.php');
$CAT_TENDER = cache_read('category-23.php');
if($EXT['mobile_enable']) $head_mobile = $EXT['mobile_url'];
$index = 1;
$seo_title = $DT['seo_title'];
$head_keywords = $DT['seo_keywords'];
$head_description = $DT['seo_description'];


$linkurl = $DT['linkurl'];
$requestUrl = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

if( $DT['index_html'] ) {

    $DT['user'] = $user;
    $DT['pushtest'] = pushlist($user);         //获取推送的查询列表

    // if(!$DT['pushtest']){
    //     $GLOBALS['nodata']=true;
    //     return true;
    // } 
    $DT['filtercategory']   = push_filtercategory($user);            //获取用户的行业信息
    $DT['filteraddress']    = push_filteraddress($user);             //获取推送的分类信息
    $DT['filtertender']     = push_filtertender($user);              //获取推送的招标行业

    $DT['zhaobiao']         = indexslist_thumb('article_23','13', '114',  '38', '7'); //招标 
//    $DT['zhongbiao'] = indexslist_thumb('article_23','16', '114', '38', '8'); //中标
//    $DT['nijian']    = indexslist_thumb('article_23','15', '75',  '25', '12');  //拟在建项
//    $DT['vips']      = indexslist_thumb('article_23','16', '100', '33', '13'); //VIP
//
//    $DT['zhuanrang'] = indexslist_thumb('article_31','19','36','12', '');//转让
//    $DT['youxiu']   = indexslist_thumb('article_32','40','45','15', '');//优秀
//    $DT['huiyuan']   = indexslist_thumb('article_33','10','50','17', '');//会员
//    $DT['zhaopin']  = indexslist_thumb('article_36','15','36','12', ''); //名企招聘
//
//    $DT['fangtans'] = indexslist_thumb('article_34','7','100','33', '');//访谈
//    $DT['huiyuanzhb'] = indexslist_thumb('article_37','15','100','33', '');//会员中标恭贺榜
    
    /*
    $catef = $db->query("SELECT * FROM {$DT_PRE}filtercategory WHERE f_cat_sm=0 order by displayorder asc");
    while($cf = $db->fetch_array($catef)){
            $catez = $db->query("SELECT * FROM {$DT_PRE}filtercategory WHERE f_cat_sm!=0 and f_cat_lg=".$cf['f_cat_lg'] . " order by displayorder asc");
            while($cz = $db->fetch_array($catez)){
                $cf['fenleiz'][] = $cz;
            }
            $fenleis[] = $cf;
    }
    $DT['fenleis'] = $fenleis;
    */ 
}



ob_start();
include template('push-weixin');
$data = ob_get_contents();
ob_clean();
$wx_filename = $CFG['com_dir'] ? DT_ROOT.'/'.$DT['push_wx_filename'] .'.'.$DT['file_ext'] : DT_CACHE.'/index.inc.html';
file_put($wx_filename, $data);


ob_start();
include template('push-email');
$data = ob_get_contents();
ob_clean();
$email_filename = $CFG['com_dir'] ? DT_ROOT.'/'.$DT['push_email_filename'] .'.'.$DT['file_ext'] : DT_CACHE.'/index.inc.html';
file_put($email_filename, $data);

return true;
?>